import APIClient from "../network/index"
//商品详情请求
const detailsModule = {
    state: {
        detailsItems: {},
        basicInfoItems:{}
    },
    mutations: {
        getDetailsList(state, items) {
            state.detailsItems = items;
        },
        basicInfo(state,items){
            state.basicInfoItems = items;
        }
    },
    actions: {
        getDetailsList(context,id) {
            APIClient.getGoodsDetails({id})
                .then(res => {
                    //检测
                    // console.log(res.data.data);
                    // console.log(res.data.data.basicInfo);
                    //赋值
                    context.commit("getDetailsList", res.data.data)
                    context.commit("basicInfo", res.data.data.basicInfo)
                })
                .catch(error => {
                    console.log(error);
                });
        }
    },
    modules: {

    }
}
export default detailsModule